#include "lpc177x_8x.h"
#include "lpc_types.h"
#include "lpc177x_8x_mci.h"
#include "lpc177x_8x_gpdma.h"
#include "debug_frmwrk.h"
#include "lpc177x_8x_rtc.h"
#include "lpc177x_8x_clkpwr.h"
#include "bsp.h"
#include "diskio.h"
#include "ff.h"
#include "sdram_k4s561632j.h"	
#include "GUI_Private.h"
#include "BUTTON.h"


 void _ShowBMP_From_SD(const char * sFilename) {
  
	volatile FILINFO bmpfile;
	FATFS fs; 
	FIL fsrc;
	UINT br, bw;
	FRESULT res; 
	uint8_t * pFile  ;
	uint32_t 	filelen;
	pFile = (uint8_t *)SDRAM_BASE_ADDR;
	disk_initialize(0);
  
	Bsp_init();
	GUI_Init();
  	f_mount(0, &fs);
    f_open(&fsrc, sFilename, FA_OPEN_EXISTING | FA_READ);
	res=f_stat(sFilename, &bmpfile);
	filelen = bmpfile.fsize;
    f_read(&fsrc, pFile, filelen, &br); 
    GUI_BMP_Draw(pFile,  0, 0); 

	f_close(&fsrc);
	f_mount(0, NULL);

}